import {
  PERSONAL_INFO_INIT,
  PERSONAL_INFO_CHANGE
  } from '../actions';
import { updateState } from '../utils';
  
  const INITIAL_STATE = {
    state: {
      doBind: false
    },
    error: {
      hasError: false
    }
  };

  export default function (state = INITIAL_STATE, action = {}) {
    switch (action.type) {
      case PERSONAL_INFO_INIT:
        {
          return {  ...state, ...INITIAL_STATE }
        }
      case PERSONAL_INFO_CHANGE:
        {
          return updateState(state, action.data);  
        }
      default:
        return state;
    }
  }